<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Architecture</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqlnd-mux.concepts.html">Concepts</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-mux.connection_pool.html">Connection pool</a></div>
 <div class="up"><a href="mysqlnd-mux.concepts.html">Concepts</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mysqlnd-mux.architecture" class="section">
  <h2 class="title">Architecture</h2>
  <p class="para">
   The mysqlnd connection multiplexing plugin is implemented as a PHP extension.
   It is written in C and operates under the hood of PHP. During the
   startup of the PHP interpreter, in the module initialization phase of the
   PHP engine, it gets registered as a
   <a href="book.mysqlnd.html" class="link">mysqlnd</a> plugin to replace specific
   mysqlnd C methods.
  </p>
  <p class="para">
   The mysqlnd library uses PHP streams to communicate with the MySQL
   server. PHP streams are accessed by the mysqlnd library through its net module.
   The mysqlnd connection multiplexing plugin proxies methods of the mysqlnd
   library net module to control opening and closing of network streams.
  </p>
  <p class="para">
   Upon opening a user connection to MySQL using the appropriate connection
   functions of either  <a href="book.mysqli.html" class="link">mysqli</a>,
   <a href="ref.pdo-mysql.html" class="link">PDO_MYSQL</a> or
   <a href="book.mysql.html" class="link">ext/mysql</a>, the plugin will search its
   connection pool for an open network connection. If the pool
   contains a network connection to the host specified by the connect function
   using the transport method requested (TCP/IP, Unix domain socket, Windows named pipe),
   the pooled connection is linked to the user handle. Otherwise, a new
   network connection is opened, put into the poolm and associated with the
   user connection handle. This way, multiple user handles can be linked
   to the same network connection.
  </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqlnd-mux.concepts.html">Concepts</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-mux.connection_pool.html">Connection pool</a></div>
 <div class="up"><a href="mysqlnd-mux.concepts.html">Concepts</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
